package top.wettis.chat.controller;

import cn.dev33.satoken.stp.StpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.wettis.chat.pojo.VO.Result;
import top.wettis.chat.service.ITodayPunchService;

/**
 * <p>
 * 每日打卡 前端控制器
 * </p>
 *
 * @author wettis
 * @since 2023-03-25
 */
@RestController
@CrossOrigin
@RequestMapping("/chat")
public class TodayPunchController {
    @Autowired
    private ITodayPunchService iTodayPunchService;



    @GetMapping("/put")
    public Result<Object> put(){
        int uid = StpUtil.getLoginIdAsInt();
        return iTodayPunchService.insert(uid);
    }

    @GetMapping("/count")
    private Result<Object> count(){
        int uid = StpUtil.getLoginIdAsInt();
        return iTodayPunchService.countPunch(uid);
    }

    @GetMapping("/getall")
    public Result<Object> getall(){
        int uid = StpUtil.getLoginIdAsInt();
        return iTodayPunchService.getall(uid);
    }


}
